package com.mls.fivedistrict.enums;

import com.baomidou.mybatisplus.enums.IEnum;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonFormat;

/**
 * @author chenhua
 * @date 2018/5/31 9:53
 */
@JsonFormat(shape = JsonFormat.Shape.OBJECT)
public enum GoodsAdvertisingEnum implements IEnum {
    TEXT("富文本","text"),
    LINKS("商品链接","links");
    private String desc;
    private String value;
    GoodsAdvertisingEnum(String desc, String value) {
        this.desc = desc;
        this.value = value;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    @Override
    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }

    @JsonCreator
    public static GoodsAdvertisingEnum getItem(String code){
        for(GoodsAdvertisingEnum item : values()){
            if(item.getValue().equals(code)){
                return item;
            }
        }
        return null;
    }
}
